package com.example.crawler.common;

import lombok.Data;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * FileName:  ResultBean
 * Author:    REZ_VK
 * Date  :   2019-5-28 9:42
 * info :    这个是..通用返回结果类
 */
@Data
public class ResultBean {

    private String code;
    private String msg;
    private Map<String,Object> body = new LinkedHashMap<>();

    public ResultBean add(String key, Object value){
        this.body.put(key,value);
        return this;
    }

    public static ResultBean success(){
        ResultBean re = new ResultBean();
        re.setCode("1");
        re.setMsg("成功");
        return re;
    }

    public static ResultBean fail(){
        ResultBean re = new ResultBean();
        re.setCode("-1");
        re.setMsg("失败");
        return re;
    }

}
